<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>操作数组之新增元素</title>
</head>

<body>
  <script>
    // 数组新增元素
    // 1. 可以向数组的末尾新增1个或者多个数组元素 数组.push(元素1...元素n)
    let arr = ['迪丽热巴']
    arr.push('xpp', 'xxx')
    console.log(arr)
    // 2. 可以向数组的开头增加1个或者多个数组元素 数组.unshift(元素1,...元素n)
    let uname = 'cxk'
    arr.unshift(uname)
    console.log(arr)
  </script>
</body>

</html>